package com.woniu.apartment.myVo;

import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class PopularApartmentVo implements Serializable {


    private static final long serialVersionUID = 1L;

    /**
     * 公寓主键
     */
    @ApiModelProperty("公寓主键")
    private Long id;

    /**
     * 公寓内房型最低租金
     */
    @Excel(name = "公寓内房型最低租金")
    @ApiModelProperty("公寓内房型最低租金")
    private BigDecimal rent;

    /**
     * 货币种类
     */
    @Excel(name = "货币种类")
    @ApiModelProperty("货币种类")
    private String currency;

    /**
     * 公寓名称
     */
    @Excel(name = "公寓名称")
    @ApiModelProperty("公寓名称")
    private String apartmentName;

    /**
     * 大图的url地址
     */
    @Excel(name = "大图的url地址")
    @ApiModelProperty("大图的url地址")
    private String imageUrl;

    private String comments;

    private ArrayList<String> items;

    private String rentInclusion;

    public String getComments() {
        return comments;
    }

    public void setComments(String comments) {
        this.comments = comments;
    }


    public ArrayList<String> getItems() {
        return items;
    }

    public void setItems(ArrayList<String> items) {
        this.items = items;
    }

    public String getRentInclusion() {
        return rentInclusion;
    }

    public void setRentInclusion(String rentInclusion) {
        this.rentInclusion = rentInclusion;
    }

    public void doRentInclusion() {
        if (items.size() == 0) {
            this.rentInclusion = "无~~~";
        }

        StringBuilder stringBuilder = new StringBuilder();
        Iterator<String> iterator = items.iterator();
        while (iterator.hasNext()) {
            String next = iterator.next();
            stringBuilder = stringBuilder.append("," + next);
        }
        String s = stringBuilder.toString();
        System.out.println("s的数值为====" + s);
        if (s.isEmpty()) {
            this.rentInclusion = "无~~~";

            return;
        }

        try {
            s = s.substring(1);
        } catch (StringIndexOutOfBoundsException e) {
            e.printStackTrace();
            s="无~~~";
        }

        this.rentInclusion = s;
    }

    private List<ApartUniVo> universityAroundApartList;


    /**
     * 综合评分
     */
    @Excel(name = "综合评分")
    @ApiModelProperty("综合评分")
    private Long score;


    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public BigDecimal getRent() {
        return rent;
    }

    public void setRent(BigDecimal rent) {
        this.rent = rent;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public String getApartmentName() {
        return apartmentName;
    }

    public void setApartmentName(String apartmentName) {
        this.apartmentName = apartmentName;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public List<ApartUniVo> getUniversityAroundApartList() {
        return universityAroundApartList;
    }

    public void setUniversityAroundApartList(List<ApartUniVo> universityAroundApartList) {
        this.universityAroundApartList = universityAroundApartList;
    }

    public Long getScore() {
        return score;
    }

    public void setScore(Long score) {
        this.score = score;
    }

    @Override
    public String toString() {
        return "PopularApartmentVo{" +
                "id=" + id +
                ", rent=" + rent +
                ", currency='" + currency + '\'' +
                ", apartmentName='" + apartmentName + '\'' +
                ", imageUrl='" + imageUrl + '\'' +
                ", comments='" + comments + '\'' +
                ", items=" + items +
                ", rentInclusion='" + rentInclusion + '\'' +
                ", universityAroundApartList=" + universityAroundApartList +
                ", score=" + score +
                '}';
    }

    /*@Override
    public String toString() {
        return "PopularApartmentVo{" +
                "id=" + id +
                ", rent=" + rent +
                ", currency='" + currency + '\'' +
                ", apartmentName='" + apartmentName + '\'' +
                ", imageUrl='" + imageUrl + '\'' +
                ", universityAroundApartList=" + universityAroundApartList +
                ", score=" + score +
                '}';
    }*/
}
